//
//  MyMoneyTableViewCell.m
//  明和智能
//
//  Created by 李李善 on 2018/8/23.
//  Copyright © 2018年 inno. All rights reserved.
//

#import "MyMoneyTableViewCell.h"

@implementation MyMoneyTableViewCell

-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(id)dataSource AtIndexPath:(NSIndexPath *)indexPath
{
    self.textLabel.textColor = [UIColor blackColor];
    self.textLabel.text = @"开启自动扣费";
    self.textLabel.font = kSysFont(kFitW(12));
    self.detailTextLabel.textColor = hexCOLOR(@"B4B4B4");
    self.detailTextLabel.font = kSysFont(kFitW(10));
    self.detailTextLabel.text = @"开启后消费时将自动从钱包扣费";
    UISwitch *Switch = [UISwitch new];
    [view addV:Switch];
    WSELF(weakSelf);
    [self onMainSetSubViewFrame:^(UIView *view, CGPoint origin, CGSize size, CGPoint center) {
        [weakSelf.textLabel sizeToFit];
        weakSelf.textLabel.left = kFitW(15);
        weakSelf.textLabel.top = kFitW(10);
        
        [weakSelf.detailTextLabel sizeToFit];
        weakSelf.detailTextLabel.left = kFitW(15);
        weakSelf.detailTextLabel.top = kFitW(10)+weakSelf.textLabel.bottom;
        
        Switch.size = CGSizeMake(kFitW(50), kFitH(25));
        Switch.right = size.width-kFitW(15);
        Switch.centerY = size.height/2;
        
    }];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end



@implementation MyMoneyTableViewCell1

-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(id)dataSource AtIndexPath:(NSIndexPath *)indexPath
{
    self.backgroundColor = [UIColor clearColor];
    
    UIView *bjView = ({
        UIView *l  = [UIView new];
        l.backgroundColor = [UIColor whiteColor];
        [view addV:l];
        l;
    });
    UILabel *money = ({
        UILabel *l  = [UILabel new];
        l.textColor = hexCOLOR(@"FD8F25");
        l.text = @"100.0";
        l.font = kSysFont(kFitW(15));
        [bjView addV:l];
        l;
    });
    UILabel *title = ({
        UILabel *l  = [UILabel new];
        l.text = @"余额(元) :";
        l.font = kSysFont(kFitW(11));
        [bjView addV:l];
        l;
    });
    
    UIButton *wanc = ({
        UIButton *l  = [UIButton buttonWithType:UIButtonTypeCustom];
        [l setNormalTitle:@"充值"];
        l.titleLabel.font = kSysFont(kFitW(13));
        [l setNormalTitleColor:[UIColor whiteColor]];
        l.backgroundColor = hexCOLOR(@"FD8F25");
        l.tag = 30;
        [l AddTarget:ViewController Action:@selector(onRightBtn:)];
        [bjView addV:l];
        l;
    });
    
    [self onMainSetSubViewFrame:^(UIView *view, CGPoint origin, CGSize size, CGPoint center) {
        
        bjView.size = CGSizeMake(size.width-kFitW(20),size.height-kFitH(10));
        bjView.left = kFitW(10);
        bjView.bottom = size.height;
        
        wanc.size = CGSizeMake(kFitW(90),kFitH(40));
        wanc.right =bjView.width-kFitW(10);
        wanc.centerY =bjView.height/2;
        
        [money sizeToFit];
        money.left = kFitW(15);
        money.bottom = bjView.height/2-kFitH(10);
        
        [title sizeToFit];
        title.left = kFitW(15);
        title.top = bjView.height/2-kFitH(10);
    }];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end



@implementation MyMoneyTableViewCell2

-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(id)dataSource AtIndexPath:(NSIndexPath *)indexPath
{
    self.backgroundColor = [UIColor clearColor];
    
    UIView *bjView = ({
        UIView *l  = [UIView new];
        l.backgroundColor = [UIColor blackColor];
        [view addV:l];
        l;
    });
    UIView *bjView1 = ({
        UIView *l  = [UIView new];
        l.backgroundColor = [UIColor blackColor];
        [view addV:l];
        l;
    });
    UILabel *money = ({
        UILabel *l  = [UILabel new];
        //l.backgroundColor = [UIColor redColor];
        l.textColor = [UIColor blackColor];
        l.text = @"购买 vip会员";
        l.font = kSysFont(kFitW(13));
        [view addV:l];
        l;
    });
    
    [self onMainSetSubViewFrame:^(UIView *view, CGPoint origin, CGSize size, CGPoint center) {
        CGFloat w = size.width/2 -kFitW(60);
        bjView.size  = CGSizeMake(w,0.5);
        bjView.left = kFitW(10);
        bjView.centerY =size.height/2;

        [money sizeToFit];
        money.centerX = size.width/2;
        money.centerY = size.height/2;
        
        bjView1.size  = CGSizeMake(w,0.5);
        bjView1.right = size.width-kFitW(10);
        bjView1.centerY =size.height/2;

    }];
}

@end



@implementation MyMoneyTableViewCell3

-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(id)dataSource AtIndexPath:(NSIndexPath *)indexPath
{
    self.backgroundColor = [UIColor clearColor];
    
    UIView *bjView = ({
        UIView *l  = [UIView new];
        l.backgroundColor = [UIColor whiteColor];
        l.hasBottomLine = YES;
        [view addV:l];
        l;
    });
    UILabel *money = ({
        UILabel *l  = [UILabel new];
        l.textColor = [UIColor blackColor];
        l.text = @"月卡30天";
        l.font = kSysFont(kFitW(15));
        [bjView addV:l];
        l;
    });
    
    UILabel *shiyong = ({
        UILabel *l  = [UILabel new];
        l.textColor = [UIColor blackColor];
        l.text = @"使用中";
        l.font = kSysFont(kFitW(15));
        [bjView addV:l];
        l;
    });
    
    UILabel *title = ({
        UILabel *l  = [UILabel new];
        l.text = @"剩余12天";
        l.font = kSysFont(kFitW(11));
        [bjView addV:l];
        l;
    });
    
    UIButton *wanc = ({
        UIButton *l  = [UIButton buttonWithType:UIButtonTypeCustom];
        [l setNormalTitle:@"续费"];
        l.titleLabel.font = kSysFont(kFitW(13));
        [l setNormalTitleColor:[UIColor whiteColor]];
        l.backgroundColor = hexCOLOR(@"FD8F25");
        [bjView addV:l];
        l;
    });
    
    [self onMainSetSubViewFrame:^(UIView *view, CGPoint origin, CGSize size, CGPoint center) {
        
        bjView.size = CGSizeMake(size.width-kFitW(20),size.height);
        bjView.left = kFitW(10);
        bjView.bottom = size.height;
        
        wanc.size = CGSizeMake(kFitW(90),kFitH(40));
        wanc.right =bjView.width-kFitW(10);
        wanc.centerY =bjView.height/2;
        
        [money sizeToFit];
        money.left = kFitW(15);
        money.top = wanc.top;
        
        [shiyong sizeToFit];
        shiyong.left = money.right+kFitW(15);
        shiyong.centerY = money.centerY;
        
        [title sizeToFit];
        title.left = kFitW(15);
        title.bottom = wanc.bottom;
    }];
}

@end
